home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c
- Subject: Re: C programer dosn't understand windows 3.1
- Date: Thu, 29 Feb 1996 16:45:19 +0200
- Organization: Carelcomp Forest
- Message-ID: <3135BBFF.7D97@cmt.lpr.mail.carel.fi>
- References: <4h44v8$i3m@pipe12.nyc.pipeline.com>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- John Dillworth wrote:
- >
- > I need to insert a blank line between each printed line of text in this
- > Windows program fragment:
- >
- >
- > for (i = nPaintBeg ; i < nPaintEnd ; i++)
- > {
- >
- >
- >
- > x = cxChar * (1 - nHscrollPos) ;
- > y = cyChar * (1 - nVscrollPos + i) ;
- >
- > TextOut (hdc, x, y,
- > sysmetrics[i].szLabel,
- > lstrlen (sysmetrics[i].szLabel)) ;
- >
- > TextOut (hdc, x + 22 * cxCaps, y,
- > sysmetrics[i].szDesc,
- > lstrlen (sysmetrics[i].szDesc)) ;
- >
- > TextOut (hdc, x, y,
- > sysmetrics[i].szLabel,
- > lstrlen (sysmetrics[i].szLabel)) ;
- >
- > TextOut (hdc, x + 22 * cxCaps, y,
- > sysmetrics[i].szDesc,
- > lstrlen (sysmetrics[i].szDesc)) ;
- >
- >
- > SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;
- >
- > TextOut (hdc, x + 22 * cxCaps + 40 * cxChar, y,
- > szBuffer,
- > wsprintf (szBuffer, "%5d",
- > GetSystemMetrics (sysmetrics[i].nIndex))) ;
- >
- > SetTextAlign (hdc, TA_LEFT | TA_TOP) ;
- > // wsprintf (szBuffer, "/n/a" );
- >
- > }
- > Now in C I plain old ANSI C I would just put a couple of printf's with
- > newline characters. This dosn't work with windows (this is c huh?? ;-) ).
- > How do I insert blank line between each line of text in this program?
- >
- > Thanks in advance
-
- Track the number of "text line" when you print a line; then, increase it by two instead
- of just one and calculate the y offset for the next line multiplying by that number.
- (BTW, in your wsprintf, "/n/a" should read "\n\a", FWIF).
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-